package com.ganbo.ms.nio;

import java.io.IOException;
import java.net.Socket;
import java.util.Date;

/**
 * @author ganbo
 * @date 2022/11/26 21:03
 */
public class IOClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 8000);

        new Thread(() -> {
            while (true){
                try {
                    socket.getOutputStream().write((new Date() +" hello world..").getBytes());
                    Thread.sleep(2000);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}

